<?php

namespace common\models\teacher;

use Yii;
use common\helpers\Url;

/**
 * This is the model class for table "{{%teacher_certificate}}".
 *
 * @property int $id
 * @property string $teacher_id 教师ID
 * @property string $type 证件类型名称
 * @property string $number 证件号码
 * @property string $src 证书地址
 * @property string $mark
 * @property int $status 状态
 * @property string $created_at 创建时间
 * @property string $updated_at 更新时间
 */
class TeacherCertificate extends \common\base\ActiveRecord {

    use \common\traits\Constants;
    use \common\traits\TimestampBehavior;

    const STATUS_ACTIVE = 10;
    const STATUS_DEFAULT = 0;

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%teacher_certificate}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['teacher_id', 'status', 'created_at', 'updated_at'], 'integer'],
            [['type', 'number'], 'string', 'max' => 50],
            [['src', 'mark'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'teacher_id' => '教师ID',
            'type' => '证件类型名称',
            'number' => '证件号码',
            'src' => '证书地址',
            'mark' => 'Mark',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }

    public function getPicture() {
        return Url::toRemote($this->src);
    }

}
